home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / misc / volume20 / compress / part02 < prev    next >
Encoding:
Text File  |  1991-06-26  |  24.3 KB  |  923 lines

  1. Newsgroups: comp.sources.misc
  2. From: Dave Mack <csu@alembic.ACS.COM>
  3. Subject:  v20i065:  compress - Compress 4.1, Part02/02
  4. Message-ID: <1991Jun25.183911.27829@sparky.IMD.Sterling.COM>
  5. X-Md4-Signature: dc34643488b8ba554ee022ec28d0e943
  6. Date: Tue, 25 Jun 1991 18:39:11 GMT
  7. Approved: kent@sparky.imd.sterling.com
  8.  
  9. Submitted-by: Dave Mack <csu@alembic.ACS.COM>
  10. Posting-number: Volume 20, Issue 65
  11. Archive-name: compress/part02
  12. Environment: UNIX
  13.  
  14. #! /bin/sh
  15. # This is a shell archive.  Remove anything before this line, then unpack
  16. # it by saving it into a file and typing "sh file".  To overwrite existing
  17. # files, type "sh file -c".  You can also feed this as standard input via
  18. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  19. # will see the following message at the end:
  20. #        "End of archive 2 (of 2)."
  21. # Contents:  Changes Acks Makefile usermem compress.1 zcmp zcmp.1 zdiff
  22. #   zmore zmore.1 patchlevel.h
  23. # Wrapped by csu@alembic on Thu May 30 16:24:07 1991
  24. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  25. if test -f 'Changes' -a "${1}" != "-c" ; then 
  26.   echo shar: Will not clobber existing file \"'Changes'\"
  27. else
  28. echo shar: Extracting \"'Changes'\" \(2126 characters\)
  29. sed "s/^X//" >'Changes' <<'END_OF_FILE'
  30. XModifications for version 4.1: 
  31. X    o Added -r command line flag to allow recursive compression/
  32. X      decompression of directory trees. As a side-effect, compress
  33. X      no longer tries to compress/decompress anything that isn't
  34. X      a regular file. In particular, it ignores symbolic links.
  35. X    o zcat no longer cares whether a filename ends in .Z or
  36. X      not - it relies on the magic number in the file. If zcat
  37. X      is given a filename that doesn't end with .Z and the file
  38. X      referenced doesn't exist, zcat will append a .Z and try
  39. X      to open that instead.
  40. X    o compress -f will now compress multiply hardlinked files.
  41. X      Uncompress does not recreate the hard link, it creates
  42. X      a new file.
  43. X    o Removed compressdir/uncompressdir - no longer needed.
  44. X    o Removed atob/btoa/tarmail/untarmail - my versions are
  45. X      based on btoa 5.2 which is not compatible with the atob
  46. X      included with compress4.0.
  47. XCompress version 4.0 improvements:
  48. X    o compress() speedup (10-50%) by changing division hash to xor
  49. X    o decompress() speedup (5-10%)
  50. X    o Memory requirements reduced (3-30%)
  51. X    o Stack requirements reduced to less than 4kb
  52. X    o Removed 'Big+Fast' compress code (FBITS) because of compress speedup
  53. X        o Portability mods for Z8000 and PC/XT (but not zeus 3.2)
  54. X    o Default to 'quiet' mode
  55. X    o Unification of 'force' flags
  56. X    o Manual page overhaul
  57. X    o Portability enhancement for M_XENIX
  58. X    o Removed text on #else and #endif
  59. X    o Added "-V" switch to print version and options
  60. X    o Added #defines for SIGNED_COMPARE_SLOW
  61. X    o Added Makefile and "usermem" program
  62. X    o Removed all floating point computations
  63. X    o New programs:
  64. X        compressdir - compress all files on a directory
  65. X        uncompressdir - uncompress all files on a directory
  66. X        zcmp - cmp compressed files
  67. X        zdiff - diff compressed files
  68. X      The following are with thanks to philabs!per:
  69. X        btoa - convert binary to ascii for mailing
  70. X        atob - convert ascii to binary with checksum
  71. X        tarmail - tar, compress, btoa, and mail files
  72. X        untarmail - restore "tarmail" files
  73. X
  74. X        WARNING: These last few programs are not compatible 
  75. X        with the original ones from the net.  The encoding
  76. X        has changed.  See btoa.c for more info.
  77. X
  78. END_OF_FILE
  79. if test 2126 -ne `wc -c <'Changes'`; then
  80.     echo shar: \"'Changes'\" unpacked with wrong size!
  81. fi
  82. # end of 'Changes'
  83. fi
  84. if test -f 'Acks' -a "${1}" != "-c" ; then 
  85.   echo shar: Will not clobber existing file \"'Acks'\"
  86. else
  87. echo shar: Extracting \"'Acks'\" \(525 characters\)
  88. sed "s/^X//" >'Acks' <<'END_OF_FILE'
  89. XAcknowledgments:
  90. X
  91. XCompress, Version 4.1
  92. X
  93. XPat Myrto (rwing!pat@cs.washington.edu) deserves the credit
  94. Xfor undoing all the damage I did to this version with respect
  95. Xto System V and for giving me the occasional kick when my
  96. Xchanges clobbered some necessary functionality.
  97. X
  98. XThanks to James A. Woods for permitting me to corrupt his baby
  99. Xand for passing along some tips on ways to improve the performance
  100. Xover 4.0.
  101. X
  102. XThanks to the previous authors whom I didn't contact, for making
  103. Xthe program available originally.
  104. X
  105. X-- 
  106. XDave Mack
  107. END_OF_FILE
  108. if test 525 -ne `wc -c <'Acks'`; then
  109.     echo shar: \"'Acks'\" unpacked with wrong size!
  110. fi
  111. # end of 'Acks'
  112. fi
  113. if test -f 'Makefile' -a "${1}" != "-c" ; then 
  114.   echo shar: Will not clobber existing file \"'Makefile'\"
  115. else
  116. echo shar: Extracting \"'Makefile'\" \(2363 characters\)
  117. sed "s/^X//" >'Makefile' <<'END_OF_FILE'
  118. X#
  119. X# Makefile for compress version 4.1
  120. X#
  121. XCC=cc
  122. X#CC=gcc -traditional
  123. X#
  124. X# set your compile flags.
  125. X# set -DVOIDSIG if your signal() function returns a pointer to
  126. X# a function returning void.
  127. X# set BSD4 if you have a generally BSDish system - SunOS, Ultrix, etc.
  128. X# If you're saddled with a system that only allows 14-character
  129. X# filenames, set -DSHORTNAMES
  130. X# include -DDIRENT if your system wants you to #include <dirent.h>
  131. X# instead of <sys/dir.h>
  132. X# The README file describes other flags you may need.
  133. X#
  134. X# CFLAGS for SunOS4.1
  135. XCFLAGS=-O -DVOIDSIG -DBSD4 -DDIRENT
  136. X# CFLAGS for System V Rel 3.x
  137. X#CFLAGS=-O -DSHORTNAMES -DDIRENT
  138. X#
  139. X# BIN is where the executables (compress, uncompress, zcat, zcmp, zdiff
  140. X# and zmore) will be installed.
  141. X#
  142. XBIN=/usr/local/bin
  143. X#
  144. X# MAN says where to install the man page
  145. X#
  146. XMAN=/usr/man/manl
  147. X#
  148. X# MANSUF is the suffix the installed manual page should have
  149. X#
  150. XMANSUF=l
  151. X#
  152. X# LN is how to make links (hard or symbolic) on your system
  153. X#
  154. XLN=ln -s
  155. X#
  156. X# LIBS contains any additional libraries you may need to link.
  157. X# In particular, you may need -lndir or equiv. to get the
  158. X# public domain directory access routines if they aren't in your libc.
  159. X#
  160. XLIBS=
  161. X#
  162. X# END OF CONFIGURATION OPTIONS
  163. X#
  164. X
  165. XSHARSET1=README compress.c
  166. XSHARSET2=Changes Acks Makefile usermem  compress.1 zcmp zcmp.1 \
  167. X    zdiff zmore zmore.1 patchlevel.h
  168. X
  169. Xall: compress
  170. X
  171. Xcompress: USERMEM compress.c
  172. X    $(CC) $(CFLAGS) -DUSERMEM=`cat USERMEM` -o compress compress.c $(LIBS)
  173. X
  174. X# USERMEM may have to be set by hand.  It should contain the amount of
  175. X# available user memory in bytes.  See the README file for more info.
  176. XUSERMEM:
  177. X    sh usermem > USERMEM
  178. X
  179. Xinstall: compress compress.1
  180. X    -mv $(BIN)/compress $(BIN)/compress.old
  181. X    cp compress $(BIN)
  182. X    rm -f $(BIN)/uncompress $(BIN)/zcat
  183. X    $(LN) $(BIN)/compress $(BIN)/uncompress
  184. X    $(LN) $(BIN)/compress $(BIN)/zcat
  185. X    cp compress.1 $(MAN)/compress.$(MANSUF)
  186. X    rm -f $(MAN)/uncompress.$(MANSUF) $(MAN)/zcat.$(MANSUF)
  187. X    $(LN) $(MAN)/compress.$(MANSUF) $(MAN)/uncompress.$(MANSUF)
  188. X    $(LN) $(MAN)/compress.$(MANSUF) $(MAN)/zcat.$(MANSUF)
  189. X    cp zmore zcmp zdiff $(BIN)
  190. X    cp zmore.1 $(MAN)/zmore.$(MANSUF)
  191. X    cp zcmp.1 $(MAN)/zcmp.$(MANSUF)
  192. X    rm -f $(MAN)/zdiff.$(MANSUF)
  193. X    $(LN) $(MAN)/zcmp.$(MANSUF) $(MAN)/zdiff.$(MANSUF)
  194. X
  195. Xclean:
  196. X    rm -f compress uncompress zcat core
  197. X
  198. Xshar:
  199. X    shar -o compress41.shar.1 -n01 -e02 $(SHARSET1)
  200. X    shar -o compress41.shar.2 -n02 -e02 $(SHARSET2)
  201. X
  202. X
  203. X
  204. X
  205. X
  206. END_OF_FILE
  207. if test 2363 -ne `wc -c <'Makefile'`; then
  208.     echo shar: \"'Makefile'\" unpacked with wrong size!
  209. fi
  210. # end of 'Makefile'
  211. fi
  212. if test -f 'usermem' -a "${1}" != "-c" ; then 
  213.   echo shar: Will not clobber existing file \"'usermem'\"
  214. else
  215. echo shar: Extracting \"'usermem'\" \(1748 characters\)
  216. sed "s/^X//" >'usermem' <<'END_OF_FILE'
  217. X: This shell script snoops around to find the maximum amount of available
  218. X: user memory.  These variables need to be set only if there is no
  219. X: /usr/adm/messages.  KMEM, UNIX, and CLICKSIZE can be set on the command
  220. X: line, if desired, e.g. UNIX=/unix
  221. XKMEM=/dev/kmem        # User needs read access to KMEM
  222. XUNIX=
  223. X# VAX            CLICKSIZE=512,    UNIX=/vmunix
  224. X# PDP-11        CLICKSIZE=64,    UNIX=/unix
  225. X# CADLINC 68000        CLICKSIZE=4096,    UNIX=/unix
  226. X# Perkin-Elmer 3205    CLICKSIZE=4096,    UNIX=/edition7
  227. X# Perkin-Elmer all others, CLICKSIZE=2048, UNIX=/edition7
  228. XCLICKSIZE=512
  229. Xeval $*
  230. X
  231. XSIZE=0
  232. Xif test -r /usr/adm/messages    # probably the most transportable
  233. Xthen
  234. X    SIZE=`grep avail /usr/adm/messages | sed -n '$s/.*[     ]//p'`
  235. Xfi
  236. X
  237. Xif test 0$SIZE -le 0        # no SIZE in /usr/adm/messages
  238. Xthen
  239. X    if test -r $KMEM        # Readable KMEM
  240. X    then
  241. X    if test -n "$UNIX"
  242. X    then
  243. X        : User must have specified it already.
  244. X    elif test -r /vmunix
  245. X    then
  246. X        UNIX=/vmunix
  247. X        CLICKSIZE=512    # Probably VAX
  248. X    elif test -r /edition7
  249. X    then
  250. X        UNIX=/edition7
  251. X        CLICKSIZE=2048    # Perkin-Elmer: change to 4096 on a 3205
  252. X    elif test -r /unix
  253. X    then
  254. X        UNIX=/unix        # Could be anything
  255. X    fi
  256. X    if test -n "$UNIX"
  257. X    then
  258. X        SIZE=`echo maxmem/D | adb $UNIX $KMEM | sed -n '$s/.*[     ]//p'`
  259. X        if test 0$SIZE -le 0
  260. X        then
  261. X        SIZE=`echo physmem/D | adb $UNIX $KMEM | sed -n '$s/.*[     ]//p'`
  262. X        fi
  263. X        SIZE=`expr 0$SIZE '*' $CLICKSIZE`
  264. X    fi
  265. X    fi
  266. Xfi
  267. X
  268. Xcase $UNIX in
  269. X    /vmunix)        # Assume 4.2bsd: check for resource limits
  270. X    MAXSIZE=`csh -c limit | awk 'BEGIN    { MAXSIZE = 1000000 }
  271. X/datasize|memoryuse/ && NF == 3    { if ($2 < MAXSIZE) MAXSIZE = $2 }
  272. XEND    { print MAXSIZE * 1000 }'`
  273. X    if test $MAXSIZE -lt $SIZE
  274. X    then
  275. X        SIZE=$MAXSIZE
  276. X    fi
  277. X    ;;
  278. Xesac
  279. X
  280. Xif test 0$SIZE -le 0
  281. Xthen
  282. X    echo 0;exit 1
  283. Xelse
  284. X    echo $SIZE
  285. Xfi
  286. END_OF_FILE
  287. if test 1748 -ne `wc -c <'usermem'`; then
  288.     echo shar: \"'usermem'\" unpacked with wrong size!
  289. fi
  290. chmod +x 'usermem'
  291. # end of 'usermem'
  292. fi
  293. if test -f 'compress.1' -a "${1}" != "-c" ; then 
  294.   echo shar: Will not clobber existing file \"'compress.1'\"
  295. else
  296. echo shar: Extracting \"'compress.1'\" \(5306 characters\)
  297. sed "s/^X//" >'compress.1' <<'END_OF_FILE'
  298. X.PU
  299. X.TH COMPRESS 1 local
  300. X.SH NAME
  301. Xcompress, uncompress, zcat \- compress and expand data (version 4.1)
  302. X.SH SYNOPSIS
  303. X.ll +8
  304. X.B compress
  305. X[
  306. X.B \-f
  307. X] [
  308. X.B \-v
  309. X] [
  310. X.B \-c
  311. X] [
  312. X.B \-V
  313. X] [
  314. X.B \-r
  315. X] [
  316. X.B \-b
  317. X.I bits
  318. X] [
  319. X.I "name \&..."
  320. X]
  321. X.ll -8
  322. X.br
  323. X.B uncompress
  324. X[
  325. X.B \-f
  326. X] [
  327. X.B \-v
  328. X] [
  329. X.B \-c
  330. X] [
  331. X.B \-V
  332. X] [
  333. X.I "name \&..."
  334. X]
  335. X.br
  336. X.B zcat
  337. X[
  338. X.B \-V
  339. X] [
  340. X.I "name \&..."
  341. X]
  342. X.SH DESCRIPTION
  343. X.I Compress
  344. Xreduces the size of the named files using adaptive Lempel-Ziv coding.
  345. XWhenever possible,
  346. Xeach file is replaced by one with the extension
  347. X.B "\&.Z,"
  348. Xwhile keeping the same ownership modes, access and modification times.
  349. XIf no files are specified, the standard input is compressed to the
  350. Xstandard output.
  351. XCompressed files can be restored to their original form using
  352. X.I uncompress
  353. Xor
  354. X.I zcat.
  355. X.PP
  356. XThe
  357. X.B \-f
  358. Xoption will force compression of
  359. X.I name.
  360. XIf
  361. X.B \-f
  362. Xis not given and
  363. X.I compress
  364. Xis run in the foreground,
  365. Xthe user is prompted as to whether an existing file should be overwritten.
  366. X.PP
  367. XThe
  368. X.B \-c
  369. Xoption makes
  370. X.I compress/uncompress
  371. Xwrite to the standard output; no files are changed.
  372. XThe nondestructive behavior of
  373. X.I zcat
  374. Xis identical to that of
  375. X.I uncompress
  376. X.B \-c.
  377. X.PP
  378. XIf the
  379. X.B \-r
  380. Xflag is specified, 
  381. X.I compress
  382. Xwill operate recursively. If any of the file names specified on the command
  383. Xline are directories, 
  384. X.I compress
  385. Xwill descend into the directory and compress all the files it finds there.
  386. X.PP
  387. X.I Compress
  388. Xuses the modified Lempel-Ziv algorithm popularized in
  389. X"A Technique for High Performance Data Compression",
  390. XTerry A. Welch,
  391. X.I "IEEE Computer,"
  392. Xvol. 17, no. 6 (June 1984), pp. 8-19.
  393. XCommon substrings in the file are first replaced by 9-bit codes 257 and up.
  394. XWhen code 512 is reached, the algorithm switches to 10-bit codes and
  395. Xcontinues to use more bits until the
  396. Xlimit specified by the
  397. X.B \-b
  398. Xflag is reached (default 16).
  399. X.I Bits
  400. Xmust be between 9 and 16.  The default can be changed in the source to allow
  401. X.I compress
  402. Xto be run on a smaller machine.
  403. X.PP
  404. XAfter the
  405. X.I bits
  406. Xlimit is attained,
  407. X.I compress
  408. Xperiodically checks the compression ratio.  If it is increasing,
  409. X.I compress
  410. Xcontinues to use the existing code dictionary.  However,
  411. Xif the compression ratio decreases,
  412. X.I compress
  413. Xdiscards the table of substrings and rebuilds it from scratch.  This allows
  414. Xthe algorithm to adapt to the next "block" of the file.
  415. X.PP
  416. XNote that the
  417. X.B \-b
  418. Xflag is omitted for
  419. X.I uncompress,
  420. Xsince the 
  421. X.I bits
  422. Xparameter specified during compression
  423. Xis encoded within the output, along with
  424. Xa magic number to ensure that neither decompression of random data nor
  425. Xrecompression of compressed data is attempted. 
  426. X.PP
  427. X.ne 8
  428. XThe amount of compression obtained depends on the size of the
  429. Xinput, the number of
  430. X.I bits
  431. Xper code, and the distribution of common substrings.
  432. XTypically, text such as source code or English
  433. Xis reduced by 50\-60%.
  434. XCompression is generally much better than that achieved by
  435. XHuffman coding (as used in
  436. X.IR pack ),
  437. Xor adaptive Huffman coding
  438. X.RI ( compact ),
  439. Xand takes less time to compute.
  440. X.PP
  441. XUnder the
  442. X.B \-v
  443. Xoption,
  444. Xa message is printed yielding the percentage of
  445. Xreduction for each file compressed.
  446. X.PP
  447. XIf the
  448. X.B \-V
  449. Xoption is specified, the current version and compile options are printed on
  450. Xstderr.
  451. X.PP
  452. XExit status is normally 0;
  453. Xif the last file is larger after (attempted) compression, the status is 2;
  454. Xif an error occurs, exit status is 1.
  455. X.SH "SEE ALSO"
  456. Xpack(1), compact(1)
  457. X.SH "DIAGNOSTICS"
  458. XUsage: compress [\-dfvcV] [\-b maxbits] [file ...]
  459. X.in +8
  460. XInvalid options were specified on the command line.
  461. X.in -8
  462. XMissing maxbits
  463. X.in +8
  464. XMaxbits must follow
  465. X.BR \-b \.
  466. X.in -8
  467. X.IR file :
  468. Xnot in compressed format
  469. X.in +8
  470. XThe file specified to
  471. X.I uncompress
  472. Xhas not been compressed.
  473. X.in -8
  474. X.IR file :
  475. Xcompressed with 
  476. X.I xx
  477. Xbits, can only handle 
  478. X.I yy
  479. Xbits
  480. X.in +8
  481. X.I File
  482. Xwas compressed by a program that could deal with
  483. Xmore 
  484. X.I bits
  485. Xthan the compress code on this machine.
  486. XRecompress the file with smaller
  487. X.IR bits \.
  488. X.in -8
  489. X.IR file :
  490. Xalready has .Z suffix -- no change
  491. X.in +8
  492. XThe file is assumed to be already compressed.
  493. XRename the file and try again.
  494. X.in -8
  495. X.IR file :
  496. Xfilename too long to tack on .Z
  497. X.in +8
  498. XThe file cannot be compressed because its name is longer than
  499. X12 characters.
  500. XRename and try again.
  501. XThis message does not occur on BSD systems.
  502. X.in -8
  503. X.I file
  504. Xalready exists; do you wish to overwrite (y or n)?
  505. X.in +8
  506. XRespond "y" if you want the output file to be replaced; "n" if not.
  507. X.in -8
  508. Xuncompress: corrupt input
  509. X.in +8
  510. XA SIGSEGV violation was detected which usually means that the input file has
  511. Xbeen corrupted.
  512. X.in -8
  513. XCompression: 
  514. X.I "xx.xx%"
  515. X.in +8
  516. XPercentage of the input saved by compression.
  517. X(Relevant only for
  518. X.BR \-v \.)
  519. X.in -8
  520. X-- not a regular file: unchanged
  521. X.in +8
  522. XWhen the input file is not a regular file,
  523. X(e.g. a directory), it is
  524. Xleft unaltered.
  525. X.in -8
  526. X-- has 
  527. X.I xx 
  528. Xother links: unchanged
  529. X.in +8
  530. XThe input file has links; it is left unchanged.  See
  531. X.IR ln "(1)"
  532. Xfor more information.
  533. X.in -8
  534. X-- file unchanged
  535. X.in +8
  536. XNo savings is achieved by
  537. Xcompression.  The input remains virgin.
  538. X.in -8
  539. X.SH "BUGS"
  540. XAlthough compressed files are compatible between machines with large memory,
  541. X.BR \-b \12
  542. Xshould be used for file transfer to architectures with 
  543. Xa small process data space (64KB or less, as exhibited by the DEC PDP
  544. Xseries, the Intel 80286, etc.)
  545. END_OF_FILE
  546. if test 5306 -ne `wc -c <'compress.1'`; then
  547.     echo shar: \"'compress.1'\" unpacked with wrong size!
  548. fi
  549. # end of 'compress.1'
  550. fi
  551. if test -f 'zcmp' -a "${1}" != "-c" ; then 
  552.   echo shar: Will not clobber existing file \"'zcmp'\"
  553. else
  554. echo shar: Extracting \"'zcmp'\" \(760 characters\)
  555. sed "s/^X//" >'zcmp' <<'END_OF_FILE'
  556. X
  557. XOPTIONS=
  558. XFILES=
  559. Xfor ARG
  560. Xdo
  561. X    case "$ARG" in
  562. X    -*)    OPTIONS="$OPTIONS $ARG";;
  563. X    *)    FILES="$FILES $ARG";;
  564. X    esac
  565. Xdone
  566. Xif test -z "$FILES"; then
  567. X    echo "Usage: zcmp [cmp_options] file [file]"
  568. X    exit 1
  569. Xfi
  570. Xset $FILES
  571. Xif test $# -eq 1; then
  572. X    FILE=`expr $1 : '\(.*\)\.Z' '|' $1`
  573. X    zcat $FILE | cmp $OPTIONS - $FILE
  574. X    STAT="$?"
  575. Xelif test $# -eq 2; then
  576. X    case "$1" in
  577. X    *.Z)    case "$2" in
  578. X        *.Z)    F=`basename $2 .Z`
  579. X            zcat $2 > /tmp/$F.$$
  580. X            zcat $1 | cmp $OPTIONS - /tmp/$F.$$
  581. X            STAT="$?";;
  582. X        *)    zcat $1 | cmp $OPTIONS - $2;;
  583. X        esac;;
  584. X    *)    case "$2" in
  585. X        *.Z)    F=`basename $2 .Z`
  586. X            zcat $2 > /tmp/$F.$$
  587. X            cmp $OPTIONS $1 /tmp/$F.$$
  588. X            STAT="$?";;
  589. X        *)    cmp $OPTIONS $1 $2
  590. X            STAT="$?";;
  591. X        esac;;
  592. X    esac
  593. X    exit "$STAT"
  594. Xelse
  595. X    echo "Usage: zcmp [cmp_options] file [file]"
  596. X    exit 1
  597. Xfi
  598. END_OF_FILE
  599. if test 760 -ne `wc -c <'zcmp'`; then
  600.     echo shar: \"'zcmp'\" unpacked with wrong size!
  601. fi
  602. chmod +x 'zcmp'
  603. # end of 'zcmp'
  604. fi
  605. if test -f 'zcmp.1' -a "${1}" != "-c" ; then 
  606.   echo shar: Will not clobber existing file \"'zcmp.1'\"
  607. else
  608. echo shar: Extracting \"'zcmp.1'\" \(797 characters\)
  609. sed "s/^X//" >'zcmp.1' <<'END_OF_FILE'
  610. X.TH ZCMP 1
  611. X.SH NAME
  612. Xzcmp, zdiff \- compare compressed files
  613. X.SH SYNOPSIS
  614. X.B zcmp
  615. X[ cmp_options ] file1
  616. X[ file2 ]
  617. X.br
  618. X.B zdiff
  619. X[ diff_options ] file1
  620. X[ file2 ]
  621. X.SH DESCRIPTION
  622. X.I  Zcmp
  623. Xand 
  624. X.I zdiff
  625. Xare used to invoke the
  626. X.I cmp
  627. Xor the
  628. X.I diff
  629. Xprogram on compressed files.  All options specified are passed directly to
  630. X.I cmp
  631. Xor
  632. X.IR diff "."
  633. XIf only 1 file is specified, then the files compared are
  634. X.I file1
  635. Xand an uncompressed
  636. X.IR file1 ".Z."
  637. XIf two files are specified, then they are uncompressed (if ending with ".Z")
  638. Xand fed to
  639. X.I cmp
  640. Xor
  641. X.IR diff "."
  642. XThe exit status from 
  643. X.I cmp
  644. Xor
  645. X.I diff
  646. Xis preserved.
  647. X.SH "SEE ALSO"
  648. Xcmp(1), diff(1), zmore(1), zcat(1), compress(1), uncompress(1)
  649. X.SH BUGS
  650. XMessages from the
  651. X.I cmp
  652. Xor
  653. X.I diff
  654. Xprograms refer to temporary filenames instead of those specified.
  655. END_OF_FILE
  656. if test 797 -ne `wc -c <'zcmp.1'`; then
  657.     echo shar: \"'zcmp.1'\" unpacked with wrong size!
  658. fi
  659. # end of 'zcmp.1'
  660. fi
  661. if test -f 'zdiff' -a "${1}" != "-c" ; then 
  662.   echo shar: Will not clobber existing file \"'zdiff'\"
  663. else
  664. echo shar: Extracting \"'zdiff'\" \(724 characters\)
  665. sed "s/^X//" >'zdiff' <<'END_OF_FILE'
  666. X
  667. XOPTIONS=
  668. XFILES=
  669. Xfor ARG
  670. Xdo
  671. X    case "$ARG" in
  672. X    -*)    OPTIONS="$OPTIONS $ARG";;
  673. X    *)    FILES="$FILES $ARG";;
  674. X    esac
  675. Xdone
  676. Xif test -z "$FILES"; then
  677. X    echo "Usage: zdiff [diff_options] file [file]"
  678. X    exit 1
  679. Xfi
  680. Xset $FILES
  681. Xif test $# -eq 1; then
  682. X    FILE=`expr $1 : '\(.*\)\.Z' '|' $1`
  683. X    zcat $FILE | diff $OPTIONS - $FILE
  684. X    STAT="$?"
  685. Xelif test $# -eq 2; then
  686. X    case "$1" in
  687. X    *.Z)    case "$2" in
  688. X        *.Z)    F=`basename $2 .Z`
  689. X            zcat $2 > /tmp/$F.$$
  690. X            zcat $1 | diff $OPTIONS - /tmp/$F.$$
  691. X            STAT="$?";;
  692. X        *)    zcat $1 | diff $OPTIONS - $2;;
  693. X        esac;;
  694. X    *)    case "$2" in
  695. X        *.Z)    zcat $2 | diff $OPTIONS $1 -
  696. X            STAT="$?";;
  697. X        *)    diff $OPTIONS $1 $2
  698. X            STAT="$?";;
  699. X        esac;;
  700. X    esac
  701. X    exit "$STAT"
  702. Xelse
  703. X    echo "Usage: zdiff [diff_options] file [file]"
  704. X    exit 1
  705. Xfi
  706. END_OF_FILE
  707. if test 724 -ne `wc -c <'zdiff'`; then
  708.     echo shar: \"'zdiff'\" unpacked with wrong size!
  709. fi
  710. chmod +x 'zdiff'
  711. # end of 'zdiff'
  712. fi
  713. if test -f 'zmore' -a "${1}" != "-c" ; then 
  714.   echo shar: Will not clobber existing file \"'zmore'\"
  715. else
  716. echo shar: Extracting \"'zmore'\" \(306 characters\)
  717. sed "s/^X//" >'zmore' <<'END_OF_FILE'
  718. XFIRST=1
  719. Xfor FILE
  720. Xdo
  721. X    if test $FIRST -eq 0; then
  722. X        echo "--More--(Next file: $FILE)\c"
  723. X        stty cbreak -echo
  724. X        ANS=`dd bs=1 count=1 2>/dev/null` 
  725. X        stty -cbreak echo
  726. X        echo " "
  727. X        if test "$ANS" = 'e'; then
  728. X            exit
  729. X        fi
  730. X    fi
  731. X    echo "------> $FILE <------"
  732. X    zcat $FILE | more
  733. X    if test -t; then
  734. X        FIRST=0
  735. X    fi
  736. Xdone
  737. END_OF_FILE
  738. if test 306 -ne `wc -c <'zmore'`; then
  739.     echo shar: \"'zmore'\" unpacked with wrong size!
  740. fi
  741. chmod +x 'zmore'
  742. # end of 'zmore'
  743. fi
  744. if test -f 'zmore.1' -a "${1}" != "-c" ; then 
  745.   echo shar: Will not clobber existing file \"'zmore.1'\"
  746. else
  747. echo shar: Extracting \"'zmore.1'\" \(3702 characters\)
  748. sed "s/^X//" >'zmore.1' <<'END_OF_FILE'
  749. X.TH ZMORE 1
  750. X.SH NAME
  751. Xzmore \- file perusal filter for crt viewing of compressed text
  752. X.SH SYNOPSIS
  753. X.B zmore
  754. X[ name ...  ]
  755. X.SH DESCRIPTION
  756. X.I  Zmore
  757. Xis a filter which allows examination of compressed text files
  758. Xone screenful at a time on a soft-copy terminal.
  759. XIt normally pauses after each screenful, printing --More--
  760. Xat the bottom of the screen.
  761. XIf the user then types a carriage return, one more line is displayed.
  762. XIf the user hits a space,
  763. Xanother screenful is displayed.  Other possibilites are enumerated later.
  764. X.PP
  765. X.I Zmore
  766. Xlooks in the file
  767. X.I /etc/termcap
  768. Xto determine terminal characteristics,
  769. Xand to determine the default window size.
  770. XOn a terminal capable of displaying 24 lines,
  771. Xthe default window size is 22 lines.
  772. X.PP
  773. XOther sequences which may be typed when
  774. X.I zmore
  775. Xpauses, and their effects, are as follows (\fIi\fP is an optional integer
  776. Xargument, defaulting to 1) :
  777. X.PP
  778. X.IP \fIi\|\fP<space>
  779. Xdisplay
  780. X.I i
  781. Xmore lines, (or another screenful if no argument is given)
  782. X.PP
  783. X.IP ^D
  784. Xdisplay 11 more lines (a ``scroll'').
  785. XIf
  786. X.I i
  787. Xis given, then the scroll size is set to \fIi\|\fP.
  788. X.PP
  789. X.IP d
  790. Xsame as ^D (control-D)
  791. X.PP
  792. X.IP \fIi\|\fPz
  793. Xsame as typing a space except that \fIi\|\fP, if present, becomes the new
  794. Xwindow size.  Note that the window size reverts back to the default at the
  795. Xend of the current file.
  796. X.PP
  797. X.IP \fIi\|\fPs
  798. Xskip \fIi\|\fP lines and print a screenful of lines
  799. X.PP
  800. X.IP \fIi\|\fPf
  801. Xskip \fIi\fP screenfuls and print a screenful of lines
  802. X.PP
  803. X.IP "q or Q"
  804. Xquit reading the current file; go on to the next (if any)
  805. X.PP
  806. X.IP e
  807. XWhen the prompt --More--(Next file: 
  808. X.IR file )
  809. Xis printed, this command causes zmore to exit.
  810. X.PP 
  811. X.IP =
  812. XDisplay the current line number.
  813. X.PP
  814. X.IP \fIi\|\fP/expr
  815. Xsearch for the \fIi\|\fP-th occurrence of the regular expression \fIexpr.\fP
  816. XIf the pattern is not found,
  817. X.I zmore
  818. Xgoes on to the next file (if any).
  819. XOtherwise, a screenful is displayed, starting two lines before the place
  820. Xwhere the expression was found.
  821. XThe user's erase and kill characters may be used to edit the regular
  822. Xexpression.
  823. XErasing back past the first column cancels the search command.
  824. X.PP
  825. X.IP \fIi\|\fPn
  826. Xsearch for the \fIi\|\fP-th occurrence of the last regular expression entered.
  827. X.PP
  828. X.IP !command
  829. Xinvoke a shell with \fIcommand\|\fP. 
  830. XThe character `!' in "command" are replaced with the
  831. Xthe previous shell command.  The sequence "\\!" is replaced by "!".
  832. X.PP
  833. X.IP ":q or :Q"
  834. Xquit reading the current file; go on to the next (if any)
  835. X(same as q or Q).
  836. X.PP
  837. X.IP .
  838. X(dot) repeat the previous command.
  839. X.PP
  840. XThe commands take effect immediately, i.e., it is not necessary to
  841. Xtype a carriage return.
  842. XUp to the time when the command character itself is given,
  843. Xthe user may hit the line kill character to cancel the numerical
  844. Xargument being formed.
  845. XIn addition, the user may hit the erase character to redisplay the
  846. X--More-- message.
  847. X.PP
  848. XAt any time when output is being sent to the terminal, the user can
  849. Xhit the quit key (normally control\-\\).
  850. X.I Zmore
  851. Xwill stop sending output, and will display the usual --More--
  852. Xprompt.
  853. XThe user may then enter one of the above commands in the normal manner.
  854. XUnfortunately, some output is lost when this is done, due to the
  855. Xfact that any characters waiting in the terminal's output queue
  856. Xare flushed when the quit signal occurs.
  857. X.PP
  858. XThe terminal is set to
  859. X.I noecho
  860. Xmode by this program so that the output can be continuous.
  861. XWhat you type will thus not show on your terminal, except for the / and !
  862. Xcommands.
  863. X.PP
  864. XIf the standard output is not a teletype, then
  865. X.I zmore
  866. Xacts just like
  867. X.I zcat,
  868. Xexcept that a header is printed before each file.
  869. X.SH FILES
  870. X.DT
  871. X/etc/termcap        Terminal data base
  872. X.SH "SEE ALSO"
  873. Xmore(1), zcat(1), compress(1), uncompress(1)
  874. END_OF_FILE
  875. if test 3702 -ne `wc -c <'zmore.1'`; then
  876.     echo shar: \"'zmore.1'\" unpacked with wrong size!
  877. fi
  878. # end of 'zmore.1'
  879. fi
  880. if test -f 'patchlevel.h' -a "${1}" != "-c" ; then 
  881.   echo shar: Will not clobber existing file \"'patchlevel.h'\"
  882. else
  883. echo shar: Extracting \"'patchlevel.h'\" \(21 characters\)
  884. sed "s/^X//" >'patchlevel.h' <<'END_OF_FILE'
  885. X#define PATCHLEVEL 0
  886. END_OF_FILE
  887. if test 21 -ne `wc -c <'patchlevel.h'`; then
  888.     echo shar: \"'patchlevel.h'\" unpacked with wrong size!
  889. fi
  890. # end of 'patchlevel.h'
  891. fi
  892. echo shar: End of archive 2 \(of 2\).
  893. cp /dev/null ark2isdone
  894. MISSING=""
  895. for I in 1 2 ; do
  896.     if test ! -f ark${I}isdone ; then
  897.     MISSING="${MISSING} ${I}"
  898.     fi
  899. done
  900. if test "${MISSING}" = "" ; then
  901.     echo You have unpacked both archives.
  902.     rm -f ark[1-9]isdone
  903. else
  904.     echo You still need to unpack the following archives:
  905.     echo "        " ${MISSING}
  906. fi
  907. ##  End of shell archive.
  908. exit 0
  909.  
  910.  
  911. -- 
  912. Kent Landfield                   INTERNET: kent@sparky.IMD.Sterling.COM
  913. Sterling Software, IMD           UUCP:     uunet!sparky!kent
  914. Phone:    (402) 291-8300         FAX:      (402) 291-4362
  915. Please send comp.sources.misc-related mail to kent@uunet.uu.net.
  916.  
  917. exit 0 # Just in case...
  918. -- 
  919. Kent Landfield                   INTERNET: kent@sparky.IMD.Sterling.COM
  920. Sterling Software, IMD           UUCP:     uunet!sparky!kent
  921. Phone:    (402) 291-8300         FAX:      (402) 291-4362
  922. Please send comp.sources.misc-related mail to kent@uunet.uu.net.
  923.